Skip to content

[cxx-interop] Allow old spelling of AppKit constants #83568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

egorzhdan
Copy link
Contributor

AppKit defines certain constants in Objective-C, and then renames them into different constants in Swift, e.g. NSUpArrowFunctionKey is renamed into NSEvent.SpecialKey.upArrow.rawValue.

In addition to that, AppKit also re-defines these constants in pure-Swift, which isn't the intended mechanism for renaming such constants.

Prior to llvm/llvm-project#145947, Clang was silently dropping the SwiftName API Notes attributes on these constants due to a bug in the name validation mechanism. Clients of AppKit relied on that behavior and continued to use the old spelling in Swift. To preserve source compatibility and avoid a deprecation error, let's continue dropping the SwiftName attribute on select constants from AppKit.

rdar://157485334

AppKit defines certain constants in Objective-C, and then renames them into different constants in Swift, e.g. `NSUpArrowFunctionKey` is renamed into `NSEvent.SpecialKey.upArrow.rawValue`.

In addition to that, AppKit also re-defines these constants in pure-Swift, which isn't the intended mechanism for renaming such constants.

Prior to llvm/llvm-project#145947, Clang was silently dropping the `SwiftName` API Notes attributes on these constants due to a bug in the name validation mechanism. Clients of AppKit relied on that behavior and continued to use the old spelling in Swift. To preserve source compatibility and avoid a deprecation error, let's continue dropping the `SwiftName` attribute on select constants from AppKit.

rdar://157485334
@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Aug 6, 2025
@egorzhdan
Copy link
Contributor Author

@swift-ci please test

@tshortli

This comment was marked as outdated.

@tshortli

This comment was marked as outdated.

@tshortli
Copy link
Contributor

tshortli commented Aug 7, 2025

@swift-ci please test macOS

@tshortli
Copy link
Contributor

tshortli commented Aug 7, 2025

@swift-ci please test Windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ interop Feature: Interoperability with C++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants